//
//  LabelAndTextFiled.m
//  UI_homework_07_UITabBarController
//
//  Created by li cheng on 16/7/23.
//  Copyright © 2016年 li cheng. All rights reserved.
//

#import "LabelAndTextFiled.h"

@interface LabelAndTextFiled()
@end


@implementation LabelAndTextFiled


- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
    }
    return self;
}


- (instancetype)initWith:(CGRect)frame labelScale:(CGFloat)labelScale textFiled:(CGFloat)textFiledScale labeName:(nonnull NSString *)name textFieldPlaceholder:(nullable NSString *)placeholder{
    self = [super initWithFrame:frame];
    if (self) {
        self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, (labelScale / (textFiledScale + labelScale) ) * frame.size.width, frame.size.height)];
        self.label.text = name;
        [self addSubview:_label];
        self.textField = [[UITextField alloc] initWithFrame:CGRectMake( (labelScale / (textFiledScale + labelScale) ) * frame.size.width, 0,frame.size.width - (labelScale / (textFiledScale + labelScale)) * frame.size.width, frame.size.height)];
        self.textField.placeholder = placeholder;
        [self addSubview:_textField];
    }
    return self;
}





/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
